﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using WinformDevelopFrame.Entity;
using WinformDevelopFrame.IRepository;
using WinformDevelopFrame.Repository;

namespace WinformDevelopFrame.Repository
{
    internal class SysDataTableRepository : BaseRepository<sysDataTable>,ISysDataTableRepository
    {
        private ISqlSugarClient _sqlSugarClient;
        public SysDataTableRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
        {
            _sqlSugarClient= sqlSugar;
        }

        public int Add(sysDataTable sysDataTable)
        {
            return Insert(sysDataTable);
        }

        public int AddList(List<sysDataTable> list)
        {
            return Insert(list);
        }

        public bool UpdateN(sysDataTable sysDataTable)
        {
            return Update(sysDataTable);
        }

        public bool UpdateList(List<sysDataTable> list)
        {
            return Update(list);
        }

        public bool DeleteN(sysDataTable sysDataTable)
        {
            return Delete(sysDataTable);
        }

        public bool DeleteList(List<sysDataTable> list)
        {
            return Delete(list);
        }

        public sysDataTable QueryById(int id)
        {
            return QueryByIdAsync(id).Result;
        }

        public List<sysDataTable> QueryList(List<int> ids)
        {
            return QueryByIDs(ids.ToArray());
        }
    }
}
